load("@fbcode//quic:defs.bzl", "mvfst_cpp_library", "mvfst_cpp_test")

oncall("traffic_protocols")

mvfst_cpp_library(
    name = "mocks",
    headers = [
        "Mocks.h",
    ],
    exported_deps = [
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic/codec:pktbuilder",
        "//quic/common/test:test_utils",
    ],
)

mvfst_cpp_test(
    name = "QuicHeaderCodec",
    srcs = [
        "QuicHeaderCodecTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic:exception",
        "//quic/codec:header_codec",
        "//quic/common:optional",
        "//quic/common/test:test_utils",
    ],
)

mvfst_cpp_test(
    name = "QuicReadCodecTests",
    srcs = [
        "QuicReadCodecTest.cpp",
    ],
    deps = [
        "//folly/io:iobuf",
        "//folly/portability:gtest",
        "//quic:exception",
        "//quic/codec:codec",
        "//quic/common/test:test_utils",
        "//quic/fizz/handshake:fizz_handshake",
    ],
)

mvfst_cpp_test(
    name = "QuicWriteCodecTests",
    srcs = [
        "QuicWriteCodecTest.cpp",
    ],
    compiler_flags = [
        "-ftemplate-backtrace-limit=0",
    ],
    supports_static_listing = False,
    deps = [
        ":mocks",
        "//folly:random",
        "//folly/io:iobuf",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//quic:constants",
        "//quic:exception",
        "//quic/codec:codec",
        "//quic/codec:decode",
        "//quic/codec:types",
        "//quic/common:buf_util",
        "//quic/common:circular_deque",
        "//quic/common/test:test_utils",
        "//quic/state:transport_settings",
    ],
)

mvfst_cpp_test(
    name = "TypesTests",
    srcs = [
        "TypesTest.cpp",
    ],
    deps = [
        "//folly:string",
        "//folly/container:array",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
        "//quic:exception",
        "//quic/codec:decode",
        "//quic/codec:types",
        "//quic/common/test:test_utils",
    ],
)

mvfst_cpp_test(
    name = "PacketNumberTest",
    srcs = [
        "PacketNumberTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//quic/codec:packet_number",
        "//quic/codec:types",
    ],
)

mvfst_cpp_test(
    name = "DecodeTests",
    srcs = [
        "DecodeTest.cpp",
    ],
    deps = [
        "//folly:random",
        "//folly/container:array",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
        "//quic/codec:codec",
        "//quic/codec:decode",
        "//quic/codec:types",
        "//quic/common/test:test_utils",
    ],
)

mvfst_cpp_test(
    name = "DefaultConnectionIdAlgoTest",
    srcs = [
        "DefaultConnectionIdAlgoTest.cpp",
    ],
    deps = [
        "//folly:random",
        "//folly/portability:gtest",
        "//quic/codec:types",
    ],
)

mvfst_cpp_test(
    name = "QuicConnectionIdTest",
    srcs = [
        "QuicConnectionIdTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/codec:types",
    ],
)

mvfst_cpp_test(
    name = "QuicPacketBuilderTest",
    srcs = [
        "QuicPacketBuilderTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        ":mocks",
        "//folly:random",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
        "//quic/codec:codec",
        "//quic/codec:pktbuilder",
        "//quic/codec:types",
        "//quic/common/test:test_utils",
        "//quic/fizz/handshake:fizz_handshake",
        "//quic/handshake:handshake",
    ],
)

mvfst_cpp_test(
    name = "QuicPacketRebuilderTest",
    srcs = [
        "QuicPacketRebuilderTest.cpp",
    ],
    deps = [
        ":mocks",
        "//folly/portability:gtest",
        "//quic/codec:codec",
        "//quic/codec:pktbuilder",
        "//quic/codec:pktrebuilder",
        "//quic/common/test:test_utils",
        "//quic/fizz/server/handshake:fizz_server_handshake",
        "//quic/server/state:server",
        "//quic/state:quic_state_machine",
        "//quic/state:state_functions",
        "//quic/state:stream_functions",
        "//quic/state/stream:stream",
    ],
)

mvfst_cpp_test(
    name = "QuicIntegerTest",
    srcs = [
        "QuicIntegerTest.cpp",
    ],
    supports_static_listing = False,
    deps = [
        "//folly:expected",
        "//folly:string",
        "//folly/io:iobuf",
        "//folly/portability:gtest",
        "//quic:exception",
        "//quic/codec:types",
        "//quic/common:optional",
    ],
)

mvfst_cpp_test(
    name = "server_connection_id_params_test",
    srcs = [
        "ServerConnectionIdParamsTest.cpp",
    ],
    deps = [
        "//folly/portability:gtest",
        "//quic/codec:types",
    ],
)
